<?php
//自动加载slim框架
require_once 'vendor/autoload.php';

$config = [
    'settings' => [
        'displayErrorDetails' => true,
    ],
];

$container = new \Slim\Container($config);
$app = new \Slim\App($container);
//$app = new \Slim\App( array('settings' => array('displayErrorDetails' => true, )));

//定义登录验证路由
$app -> post("/admin", "app\Controllers\AdminController:Login")->add(new app\Middlewares\AdminMiddleware);

//定义查询路由
$app -> get("/customer/search", "app\Controllers\CustomerController:searchCustomer");

//定义删除路由
$app->post("/customer/delete","app\Controllers\CustomerController:deleteCustomer");

//定义编辑路由
$app->post("/customer/modify","app\Controllers\CustomerController:modifyCustomer");

//定义增加路由
$app->post("/customer/insert","app\Controllers\CustomerController:insertCustomer");

//定义用户查询路由
$app -> get("/user/search", "app\Controllers\UserController:searchUser");

//定义用户删除路由
$app->post("/user/delete","app\Controllers\UserController:deleteUser");

//定义用户编辑路由
$app->post("/user/modify","app\Controllers\UserController:modifyUser");

//定义用户增加路由
$app->post("/user/insert","app\Controllers\UserController:insertUser");

//定义角色查询路由
$app -> get("/role/search", "app\Controllers\RoleController:searchRole");

//定义角色删除路由
$app->post("/role/delete","app\Controllers\RoleController:deleteRole");

//定义角色编辑路由
$app->post("/role/modify","app\Controllers\RoleController:modifyRole");

//定义角色增加路由
$app->post("/role/insert","app\Controllers\RoleController:insertRole");

//定义权限查询路由
$app -> get("/authorization/search", "app\Controllers\AuthorizationController:searchAuthorization");

//定义权限删除路由
$app->post("/authorization/delete","app\Controllers\AuthorizationController:deleteAuthorization");

//定义权限编辑路由
$app->post("/authorization/modify","app\Controllers\AuthorizationController:modifyAuthorization");

//定义权限增加路由
$app->post("/authorization/insert","app\Controllers\AuthorizationController:insertAuthorization");

//运行 app
$app -> run();
?>